﻿using System;
using System.Text;
using System.Collections.Generic;
using Demo_G.O.S.E.ServerEngine.Timer;

namespace Demo_G.O.S.E.ServerEngine.Mobile
{
    /// <summary>
    /// 
    /// </summary>
    internal class ManaTimer : TimeSlice
    {
        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private GeneralMobile m_Owner;
        #endregion

        #region zh-CHS 构造和初始化和清理 | en Constructors and Initializers and Dispose
        /// <summary>
        /// 
        /// </summary>
        /// <param name="generalMobile"></param>
        public ManaTimer( GeneralMobile generalMobile )
            : base( GeneralMobile.GetManaRegenRate( generalMobile ), GeneralMobile.GetManaRegenRate( generalMobile ) )
        {
            this.Priority = TimerPriority.FiftyMS;
            m_Owner = generalMobile;
        }
        #endregion

        #region zh-CHS 保护方法 | en Protected Methods
        /// <summary>
        /// 
        /// </summary>
        protected override void OnTick()
        {
            if ( m_Owner.CanRegenMana )
                m_Owner.Mana++;

            DelayTime = IntervalTime = GeneralMobile.GetManaRegenRate( m_Owner );
        }
        #endregion
    }
}

